#include "header.h"

extern ofstream debugfile;

void gotoxy ( int x, int y )
{
  COORD coord = {x, y};
  SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord );
}

void setColor(int k)
{
  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), k);
}

void debug(string s)
{
  debugfile << s << endl;
}

void debugint(string s, int n)
{
  debugfile << s << " " << n << endl;
}

room doRoomsCollide(room one, room two)
{
  int left = max(one.x,two.x);
  int right = min((one.x+one.w),(two.x+two.w));
  int top = max(one.y,two.y);
  int bottom = min((one.y+one.h),(two.y+two.h));
  if (left >= right or top >= bottom)
  {
    return room(); //Returns -1 in all variables here
  }
  else
  {
    return room(left, top, right-left, bottom-top); //Returns rectangle of collision
  }
}
